#include "mainw.h"
#include "ui_mainw.h"
#include <QDebug>
#include "mainwindow.h"
#include "mythread.h"
#include "multichat.h"

MainW::MainW(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MainW),
    chat_client(ChatClient::getChatClientInstance())
{
    ui->setupUi(this);
    QObject::connect(this,SIGNAL(sendSig(int)),this,SLOT(getRev(int)));
}

MainW::~MainW()
{
    delete ui;
}


void MainW::on_priv_clicked()
{
    int i = chat_client.checkConnState();
    if (i == 1) {
        MyThread *client = new MyThread;
        client->start();
    }
    chat_client.sendSynSlots();
    emit sendSig(i);
}
void MainW::getRev(int i){
    if(i == 1)
    {
        m.show();
        //this->close();
    }

}


void MainW::on_multi_clicked()
{
    MultiChat *m_c = new MultiChat;
    m_c->show();
}
